package Map;

import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

public class test1 {
    public static void main(String[] args) {
        Map<String,String> m = new HashMap<>();
        m.put("郭靖","黄蓉");
        m.put("王国维","人间词话");
        m.forEach(new BiConsumer<String, String>() {
            @Override
            public void accept(String key, String value) {
                System.out.println(key+value);
            }
        });


        m.forEach((String key, String value)-> {
                System.out.println(key+"="+value);
            }
        );
        m.forEach((key,value)-> System.out.println(key+value));
        //获取所有的键把其放在单列集合中
        Set<String> keys = m.keySet();
        for (String key : keys) {
            System.out.println(key);
        }
    }
}
